#include <winsock2.h>//<netdb.h>
#include <stdio.h>
/*
#include <stdio.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
*/
#define winsock_version 0x0101
#pragma comment(lib,"ws2_32.lib") 
int main()
{
  char  **ptr;
  char * domain = "talk.google.com";
  struct in_addr        addr;
  struct hostent        *host;
  char szHostName[256];
  WSADATA wsadata;
  WSAStartup(winsock_version, &wsadata);
  gethostname(szHostName,256);
  printf("host name is %s\n", szHostName);
  host = gethostbyname(domain);
  if (host == NULL)
  {
	  printf("failed %d\n", WSAGetLastError());
    //printf("failed %s\n", hstrerror(h_errno));
    return 1;
  }

  printf("h_name\t= %s\n", host->h_name);

  ptr = host->h_aliases;
  while (*ptr)
  {
    printf("alias\t= %s\n", *ptr);
    ptr++;
  }

  ptr = host->h_addr_list;
  while (*ptr)
  {
    addr.s_addr = *(int *)*ptr;
    printf("addr\t= %s\n", inet_ntoa(addr));
    ptr++;
  }

  return 0;
}

